var etaCard = {
    id: "etaCardTable",
    seItem: null,
    table: null,
    layerIndex: -1
};

etaCard.initColumn = function () {
    return [
        {title: '', field: 'id', visible: false, align: 'center', valign: 'middle', width: '50px'},
        {title: '患者姓名', field: 'customerName', align: 'center', valign: 'middle', sortable: true},
        {title: '患者电话', field: 'customerPhone', align: 'center', valign: 'middle', sortable: true},
        {title: '项目名称', field: 'payServiceName', align: 'center', valign: 'middle', sortable: true},
        {title: '原编号', field: 'etaCardY', align: 'center', valign: 'middle', sortable: true},
        {title: '新编号', field: 'etaCard', align: 'center', valign: 'middle', sortable: true},
        {title: '操作人', field: 'singlePerson', align: 'center', valign: 'middle', sortable: true},
        {title: '操作时间', field: 'createTime', align: 'center', valign: 'middle', sortable: true},
        {title: '门诊', field: 'outpatientName', align: 'center', valign: 'middle', sortable: true},
    ];
};

etaCard.formParams = function () {
    var queryData = {};
    queryData['singlePerson'] = $("#singlePerson").val();
    queryData['customerPhone'] = $("#customerPhone").val();
    queryData['customerName'] = $("#customerName").val();
    queryData['etaCard'] = $("#etaCard").val();
    queryData['startTime'] = $("#startTime").val();
    queryData['endTime'] = $("#endTime").val();
    queryData['outpatientName'] = $("#outpatientName").val();
    return queryData;
};

etaCard.resetSearch = function () {
    $("#singlePerson").val("");
    $("#customerPhone").val("");
    $("#customerName").val("");
    $("#etaCard").val("");
    $("#startTime").val("");
    $("#endTime").val("");
    $("#outpatientName").val("");
    etaCard.search();
};

etaCard.search = function () {
    etaCard.table.refresh({query: etaCard.formParams()});
};
etaCard.today = function () {//点击上面状态筛选表格
    $("#startTime").val(setDateTime(new Date(),0) + " " + "00:00:00");
    $("#endTime").val(setDateTime(new Date(),0) + " " + "23:59:59");
    etaCard.search();
};

$(function () {
    var defaultColunms = etaCard.initColumn();
    var table = new BSTable(etaCard.id, "/etaCardLog/list", defaultColunms);
    table.setPaginationType("server");
    table.setQueryParams(etaCard.formParams());
    etaCard.table = table.init();
    etaCard.today();
    $(document).on('click','#laydate_clear,#laydate_today,#laydate_ok',function () {etaCard.search();});
    checkDate = function () {etaCard.search();};
});